package top.lidee.common.service;

import com.baomidou.mybatisplus.extension.service.IService;
import top.lidee.common.dto.AccountInfo;
import top.lidee.common.dto.UserInfo;
import top.lidee.framework.exception.BusinessCheckException;
import top.lidee.framework.pagination.PaginationRequest;
import top.lidee.framework.pagination.PaginationResponse;
import top.lidee.framework.result.ResponseResult;
import top.lidee.repository.model.MtMerchant;
import top.lidee.repository.model.twice.vo.applet.GetByMerchantsIdEchoVo;
import top.lidee.repository.model.twice.vo.applet.MtMerchantVo;

import java.util.List;
import java.util.Map;

/**
 * 商户业务接口
 *
 * Created by FSQ
 * CopyRight https://www.lidee.top
 */
public interface MerchantService extends IService<MtMerchant> {

    /**
     * 分页查询商户列表
     *
     * @param paginationRequest
     * @return
     */
    PaginationResponse<MtMerchant> queryMerchantListByPagination(PaginationRequest paginationRequest,Integer managerId) throws BusinessCheckException;

    /**
     * 保存商户信息
     *
     * @param  mtMerchant
     * @throws BusinessCheckException
     * @return
     */
    MtMerchant saveMerchant(MtMerchant mtMerchant) throws BusinessCheckException;

    /**
     * 根据ID获取商户信息
     *
     * @param  id 商户ID
     * @throws BusinessCheckException
     * @return
     */
    MtMerchant queryMerchantById(Integer id) throws BusinessCheckException;

    /**
     * 根据名称获取商户信息
     *
     * @param  name 商户名称
     * @throws BusinessCheckException
     * @return
     */
    MtMerchant queryMerchantByName(String name) throws BusinessCheckException;

    /**
     * 根据商户号获取商户信息
     *
     * @param  merchantNo 商户号
     * @return
     */
    MtMerchant queryMerchantByNo(String merchantNo);

    /**
     * 根据商户号获取商户ID
     *
     * @param  merchantNo 商户号
     * @return
     */
    Integer getMerchantId(String merchantNo);

    /**
     * 更新商户状态
     *
     * @param id       商户ID
     * @param operator 操作人
     * @param status   状态
     * @throws BusinessCheckException
     * @return
     */
    void updateStatus(Integer id, String operator, String status) throws BusinessCheckException;

    /**
     * 根据条件查询商户
     *
     * @param params 查询参数
     * @return
     * */
    List<MtMerchant> queryMerchantByParams(Map<String, Object> params) throws BusinessCheckException;

    //===========================================================================

    /**
     * @description 成为商户
     * @param vo
     * @return top.lidee.framework.result.ResponseResult
     * @author zhangyiheng
     * @date 2024/9/24 09:49
     */
    ResponseResult becomeAMerchant(MtMerchantVo vo, UserInfo userInfo);

    /**
     * @description 根据分类id查询商户信息 分页
     * @param params
     * @return top.lidee.framework.result.ResponseResult
     * @author zhangyiheng
     * @date 2024/9/25 10:49
     */
    ResponseResult conditionalQueries(Map<String, Object> params);

    /**
     * @description 搜索栏：根据商户标题(名)/地址,模糊搜索分页
     * @param params
     * @return top.lidee.framework.result.ResponseResult
     * @author zhangyiheng
     * @date 2024/9/25 11:03
     */
    ResponseResult conditionalLikeQueries(Map<String, Object> params);

    /**
     * @description 点击商户进入商铺，查询商品
     * @param merchantsId
     * @return top.lidee.framework.result.ResponseResult
     * @author zhangyiheng
     * @date 2024/9/25 11:19
     */
    ResponseResult getInfoAShopListByMerchantsId(Integer merchantsId);

    /**
     * @description 查询当前用户是否是商户
     * @param userInfo
     * @return top.lidee.framework.result.ResponseResult
     * @author zhangyiheng
     * @date 2024/9/26 10:11
     */
    ResponseResult isMerchant(UserInfo userInfo);

    /**
     * @description 在保证是当前商户下 根据店铺id查询店铺
     * @param storeId
     * @return top.lidee.framework.result.ResponseResult
     * @author zhangyiheng
     * @date 2024/9/26 15:49
     */
    ResponseResult getStoreById(Integer storeId,Integer merchantsId);

    //==============MtMerchantInterceptController start==============

    /**
     * @description 查询当前用户下的商户以及商户对应店铺和店铺商品信息
     * @param userInfo
     * @return top.lidee.framework.result.ResponseResult
     * @author zhangyiheng
     * @date 2024/9/26 16:36
     */
    ResponseResult getCurrentUserCorrespondsMerchantsAll(UserInfo userInfo);

    /**
     * @description 根据当前登录用户下的merchantsId回显数据
     * @param userInfo
     * @return top.lidee.framework.result.ResponseResult
     * @author zhangyiheng
     * @date 2024/9/27 10:11
     */
    ResponseResult getByMerchantsIdEcho(UserInfo userInfo);

    /**
     * @description 修改商户
     * @param userInfo
     * @param vo
     * @return top.lidee.framework.result.ResponseResult
     * @author zhangyiheng
     * @date 2024/9/27 10:28
     */
    ResponseResult updateByMerchants(UserInfo userInfo, GetByMerchantsIdEchoVo vo);

    //==============MtMerchantInterceptController end==============



}
